package HLLibClasses;

import HLCode.HLClassManager;
import HLCode.HLLibClass;
import HLCode.HLObject;
import HLLib.base.HLString;
import HLLib.http.HLHttpClient;
import HLLib.http.HLHttpObject;

public class HLClassHttpClient extends HLLibClass {
    public HLClassHttpClient(HLClassManager owner) {
        super(owner);
    }

    public HLObject NewObject() {
        return new HLHttpClient();
    }

    public void Execute(HLObject self, int index, HLObject args, HLObject resultOwnerObject, int resultIndex) {
        switch (index) {
        case 0: {
            ((HLHttpClient) self).SetServer((HLString)args.GetObject(0), (HLString)args.GetObject(1));
            break;
        }
        case 1: {
            ((HLHttpClient) self).start();
            break;
        }
        case 2: {
            ((HLHttpClient) self).stop();
            break;
        }
        case 3: {
            ((HLHttpClient) self).Cancel();
            break;
        }
        case 4: {
            ((HLHttpClient) self).sendInsertAtIndex((HLHttpObject)args.GetObject(0), args.GetInt(0));
            break;
        }
        case 5: {
            ((HLHttpClient) self).send((HLHttpObject)args.GetObject(0));
            break;
        }
        case 6: {
            ((HLHttpClient) self).Clear();
            break;
        }
        case 7: {
            if (resultOwnerObject == null) {
                ((HLHttpClient) self).getReceivedDatas();
            } else {
                resultOwnerObject.SetObject(resultIndex, ((HLHttpClient) self).getReceivedDatas());
            }
            break;
        }
        case 8: {
            ((HLHttpClient) self).run();
            break;
        }
        }
    }
}
